import {defineStore} from 'pinia'
import api from '@/api/userInfo'
import type {mingzi} from '@/api/userInfo'
export const useUserInfoStore=defineStore('userInfo',{
  state(){
    return{
      token:'',
      userInfo:{}
    }
  },
  actions:{
    async login(aaa:mingzi){
     try {
      const result= await api.getlogin(aaa) 
      this.token=result.token
     } catch (error) {
      return Promise.reject(error)
     }
    },
    async Info(){
      try {
        const res1=await api.getInfo()
        this.userInfo=res1
        return 'ok'
      } catch (error) {
        return Promise.reject(error)
      }
    },
    async reset(){
      this.token='',
      this.userInfo={}
    }
  },
  getters:{}
})
